import sys
import os
import re

r = os.popen('nslookup -timeout=2 %s' % sys.argv[1]).read()
f = open('./lookups/tmp_lookup%s' % sys.argv[2], 'w')

try:
    print re.search('name = (.+).\n', r).groups()[0]
except AttributeError:
    print 'N/A'